fish-cache: fix cache path on linux
authorVictor Ananjevsky <ananasik@gmail.com>
Sun, 12 Mar 2017 19:01:38 +0000 (20:01 +0100)
committerØyvind Kolås <pippin@gimp.org>
Sun, 12 Mar 2017 19:01:38 +0000 (20:01 +0100)
make babl on linux honor $XDG_CACHE_HOME variable, falling back to using
$HOME/.cache

babl/babl-cache.c

index 5f7b71636f71f744cb4179fd348ed8a3ac943a6a..f4981156153e2e1cfef4d52be5cd4d7c5ed11b84 100644 (file)
@@ -78,7 +78,9 @@ static const char *fish_cache_path (void)
 
   strncpy (path, FALLBACK_CACHE_PATH, 4096);
 #ifndef _WIN32
-  if (getenv ("HOME"))
+  if (getenv ("XDG_CACHE_HOME"))
+    sprintf (path, "%s/babl/babl-fishes", getenv("XDG_CACHE_HOME"));
+  else if (getenv ("HOME"))
     sprintf (path, "%s/.cache/babl/babl-fishes", getenv("HOME"));
 #else
 {